
local completed = achievements.GetValue( "Dedicated", "total", 0 ) == 1
local desc = { [ true ] = { 1, "03:00:00" }, [ false ] = { 0, "00:00:00" } }

if ( !SinglePlayer() ) then
	desc[ false ] = { 0, "Not in SP" }
end

if ( !completed && SinglePlayer() ) then
	local startTime = CurTime()
	local function Update()
		local time = CurTime() - startTime		
		achievements.Update( "Dedicated", time / 10800, achievements.FormatTime( time, "h:m:s" ) )
		
		if ( time >= 10800 ) then
			achievements.SetValue( "Dedicated", "total", 1 )
			timer.Destroy( "Achievements.Dedicated" )
		end
	end
	timer.Create( "Achievements.Dedicated", 1, 0, Update )
end

achievements.Register(
	"Dedicated", "Play on singleplayer on the same map for three hours straight.", "achievements/dedicated",
	desc[ completed ][ 1 ], desc[ completed ][ 2 ]
)